unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TRttiDemo=class(TPersistent)
  private
    FName:string;
    FCode:string;
  published
    property Name:string read FName write FName;
    property Code:string read FCode write FCode;
  end;
  
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
  public
  end;

var
  Form1: TForm1;

implementation

uses
  TypInfo;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  I,J:Integer;
  PropList:PPropList;
  RttiDemo:TRttiDemo;
begin
  J:=GetPropList(TRttiDemo.ClassInfo,PropList);

  for I:= Low(PropList^) to J-1 do
  begin
    ShowMessage(PropList[I]^.Name);
  end;

  RttiDemo:=TRttiDemo.Create;
  RttiDemo.FName:='X';
  RttiDemo.FCode:='Y';

  ShowMessage(GetPropValue(RttiDemo,'Name'));
end;

end.
